<div class="detailsBox">
<div class="openBox">
  <h3>仓库信息</h3>
	<div class="detaiTab">
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
           <tbody>
   					<tr>
                        <td width="15%" align="right" class="bg"> 仓库性质： </td>
                        <td width="35%"> 
                        	<@select dataSouceType="storeNature" name="storeNature"
                        		id="storeNature" value="${view.storeNature}" renderonly="true"/>
                        </td>
                        <td width="15%" align="right" class="bg"> 仓库类型：</td>
                        <td>
							<@select dataSouceType="storeType" name="storeType"
                        		id="storeType" value="${view.storeType}" renderonly="true"/>
						</td>
                    </tr>
                    
                    <tr>
                       <td width="15%" align="right" class="bg"> 仓库地址：</td>
                        <td colspan="3">
                        <#if type=="detail" || approvalStatus=='UNDO'>
							<span id="ckdz"><@select dataSouceType="province" name="storeprovince"  id="select_store_provinceId" value="${view.storeprovince}" renderonly="true" />
                           		&nbsp;&nbsp;<@select dataSouceType="city" dataSouceFrom="${view.storeprovince}" name="storecity"  id="select_store_cityId"  value="${view.storecity}"renderonly="true"/>
                            	&nbsp;&nbsp;<@select dataSouceType="country" dataSouceFrom="${view.storecity}" name="storecounty"  id="select_store_districtId" value="${view.storecounty}" renderonly="true"/>
                            	&nbsp;&nbsp;${view.storeaddress}</span>&nbsp;&nbsp;
                            	<a href="javascript:void(0);" target="_blank" onclick="ckdzmap(this)">地图中查看</a>
						<#else>
							*********
							<@permission permissionName="UpdateInternalInfo">
								<a class="action-ajax-btn fr edit btn_blue" href="/mainStoreInfoRest/view_address?storeId=${view.id}">查看</a>
							</@permission>
						</#if>
                            
                        </td>
                    </tr>
                    
                    <tr>
						<td width="15%" align="right" class="bg"> 面积：</td>
                        <td>${view.acreage} </td>
                        <td width="15%" align="right" class="bg"> 年租金：</td>
                       <td>${view.rent} </td>
                    </tr>
                    <tr>
						<td width="15%" align="right" class="bg"> 租赁合同起止日期 ：</td>
                        <td>${view.rentStartDate} ~ ${view.rentEndDate} </td>
                        <td width="15%" align="right" class="bg"> 存货价值预估：</td>
                       <td>${view.stock} </td>
                    </tr>
                    
                    <tr>
                    	<td width="15%" align="right" class="bg"> 存货的交叉验证：</td>
                        <td colspan="3">
							<@select type="checkbox" dataSouceType="stockType_JC" name="stockType" value="${view.stockType}" id="stockType" renderonly="true"/>
                        </td>
                    </tr>
                    <tr>
                        <td width="15%" align="right" class="bg"> 进货周期（旺季）：</td>
                        <td>
							<@select dataSouceType="isStock" name="isStock"
                        		id="isStock" value="${view.isStock}" renderonly="true"/>
						</td>
	                    <td width="15%" align="right" class="bg"> 平均进货量/次（元）：</td>
                        <td>${view.stockMoney}</td>
                    </tr>
                    <tr>
                    	<td width="15%" align="right" class="bg"> 存货效期描述 ：</td>
                        <td colspan='3'>
                            <textarea name="ps" cols="60" rows="4" maxlength="1000" placeholder="描述（1000字以内）" readonly="readonly">${view.ps}</textarea>
                        </td>
                    </tr>
                    
			   </tbody>
          </table>
	</div> 
	</div>
</div>

 <@js>
 
 function bgdzmap(obj){
	var location = $('#bgdz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}

function mddzmap(obj){
	var location = $('#mddz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}

function yyzzdzmap(obj){
	var location = $('#yyzzdz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}

function ckdzmap(obj){
	var location = $('#ckdz').html().replace(/[\r\n &nbsp;]/g,'');
	obj.href='http://api.map.baidu.com/geocoder?address='+location+'&output=html&src=';
}

 function storeprovinceOnchange(){
        var provinceCode = $("#select_store_provinceId").val();
        var url="<@url value='/common/findCityByProvinceCode' domain='${crmUrl}'/>";
        $.ajax({
        type: "GET",
        url:url,
        data:{provinceCode:provinceCode},
        dataType:"jsonp",
        jsonp:"_callback",
        success:function(result){
   var t = $("#select_store_cityId").find("option:selected").text();
        $("#select_store_cityId").empty();
        $("#select_store_cityId").append("<option value=''>请选择</option>");

        $.each(result.data,function(key,value){
   if(t==value[1]){
   $("#select_store_cityId").append("<option selected = 'selected' value='"+value[0]+"'>"+value[1]+"</option>");
   }else{
   $("#select_store_cityId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");
   }
        });
        }
        });
   storecityOnchange();
        }


        function storecityOnchange(){
        var cityCode = $("#select_store_cityId").val();
        var url="<@url value='/common/findDistrictByCityCode' domain='${crmUrl}'/>";
        $.ajax({
        type: "GET",
        url:url,
        data:{cityCode:cityCode},
        dataType:"jsonp",
        jsonp:"_callback",
        success:function(result){
   var t = $("#select_store_districtId").find("option:selected").text();
        $("#select_store_districtId").empty();
        $("#select_store_districtId").append("<option value=''>请选择</option>");

        $.each(result.data,function(key,value){
   if(t==value[1]){
   $("#select_store_districtId").append("<option selected = 'selected' value='"+value[0]+"'>"+value[1]+"</option>");
   }else{
   $("#select_store_districtId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");
   }
        });
        }
        });
        }
 
	 var document_no = $('#document_no').text();
	 $('#age').text(getAge(document_no));
	 $('#sex').text(getSex(document_no) == 'M'? '男':'女 ');
	 
	 //根据身份证信息获取年龄
	function getSex(UUserCard){
		//获取出生日期
		UUserCard.substring(6, 10) + "-" + UUserCard.substring(10, 12) + "-" + UUserCard.substring(12, 14);
		//获取性别
		if (parseInt(UUserCard.substr(16, 1)) % 2 == 1) {
			//alert("男");
		  	return 'M';
		} else {
			//alert("女");
			return 'F';
		}
	}
	
	  function getAge(UUserCard){
		var myDate = new Date();
		var month = myDate.getMonth() + 1;
		var day = myDate.getDate();
		var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
		if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) {
			age++;
		}
		//alert(age);
		return age;
    }
	
</@js>
<@jsRender/>
